using System.Collections.ObjectModel;
using FireStarterModeller.BO;
using Habanero.Base;
using Habanero.BO;
using NUnit.Framework;

namespace FireStarterModeller.Test.BO
{
    /// <summary>
    /// Provides a place to write custom tests for DMLookupListSimple objects.
    /// This file is only written once and can be changed.  The Def file
    /// attached to this as a dependent is rewritten with each regeneration
    /// and contains the standard tests for DMLookupListSimple.
    /// Regenerate this test project whenever there have been changes to the
    /// business objects.
    /// If tests are failing due to a unique setup in your application,
    /// you can either override the Create methods in TestUtils, or you
    /// can add the test to the ignore list below and reimplement it here.
    /// </summary>
    public partial class TestDMLookupListSimple
    {
        [TestFixtureSetUp]
        public void SetupTestFixture()
        {
            //------------------------------------------------------------
            // Use this list to ignore generated tests that are failing
            // due to a unique condition in your application.
            // Remember to reimplement the test here.
            //------------------------------------------------------------
            //_ignoreList.Add("TestMethodName", "Reason for ignoring it");
            base.SetupFixture();
        }

        [Test]
        public void Test_ToString()
        {
            //---------------Set up test pack-------------------

            DMLookupListSimple dmLookupListSimple = TestUtilsDMLookupListSimple.CreateUnsavedValidDMLookupListSimple();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            string actualToString = dmLookupListSimple.ToString();
            //---------------Test Result -----------------------
            Assert.AreEqual(dmLookupListSimple.SimpleLookupListID.ToString(), actualToString);
        }

        [Test]
        public void Test_DMLookupListSimpleMustHaveItemRule_ShouldBeOnBusinessObject()
        {
            //---------------Set up test pack-------------------
            DMLookupListSimple dmLookupListSimple = new DMLookupListSimple();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            ReadOnlyCollection<IBusinessObjectRule> rules = BOHelper.GetBusinessObjectRules(dmLookupListSimple);
            //---------------Test Result -----------------------
            TestUtilsShared.AssertHasRuleOfType<DMLookupListSimpleMustHaveItemRule>(rules);
        }
//        [Test]
//        public void Test_ToString_IDIsNull()
//        {
//            //---------------Set up test pack-------------------
//            DMLookupListSimple dmSimpleLookupList = TestUtilsDMSimpleLookupList.CreateUnsavedValidDMSimpleLookupList();
//            dmSimpleLookupList.SimpleLookupListID = null;
//            //---------------Assert Precondition----------------
//            Assert.IsNull(dmSimpleLookupList.SimpleLookupListID);
//            //---------------Execute Test ----------------------
//            string actualToString = dmSimpleLookupList.ToString();
//            //---------------Test Result -----------------------
//            Assert.AreEqual(dmSimpleLookupList.SimpleLookupListID.ToString(), actualToString);
//        } 




        [Test]
        public void Test_CreateListItems_ShouldSetOrdinals()
        {
            //---------------Set up test pack-------------------
            DMLookupListSimple lookupListSimple = new DMLookupListSimple();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            DMListItem listItem1 = lookupListSimple.ListItems.CreateBusinessObject();
            DMListItem listItem2 = lookupListSimple.ListItems.CreateBusinessObject();
            DMListItem listItem3 = lookupListSimple.ListItems.CreateBusinessObject();
            DMListItem listItem4 = lookupListSimple.ListItems.CreateBusinessObject();
            DMListItem listItem5 = lookupListSimple.ListItems.CreateBusinessObject();
            DMListItem listItem6 = lookupListSimple.ListItems.CreateBusinessObject();
            //---------------Test Result -----------------------
            TestUtilsShared.AssertItemsAreInOrder(listItem1, listItem2, listItem3, listItem4, listItem5, listItem6);
        }
    }
}